﻿
namespace Marmat.Forms
{
    internal partial class TreePopupControl : PopupControl
    {
        public TreePopupControl()
        {
            InitializeComponent();
            TreeList1.Name = "TreeList1";
        }

        private void TreeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            if (e.Node is object)
            {
                if (this.OwnerEdit is object)
                {
                    this.Value = e.Node[((TreeListBox)this.OwnerEdit.Parent).KeyFieldName];
                    this.CloseDropDown();
                }
                else
                {
                    this.Value = e.Node[((TreeListBox)this.Parent.Parent).KeyFieldName];
                    this.CloseDropDown();
                }
            }
        }
    }
}